package com.nave.princesslife.baseboard.functionality;

import java.util.List;

import com.nave.princesslife.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Store_Adapter extends BaseAdapter {

	private Context context;
	private List<Store_Base> products;

	public Store_Adapter(Context context, List<Store_Base> products) {
		this.context = context;
		this.products = products;
	}

	@Override
	public int getCount() {
		return products.size();
	}

	@Override
	public Object getItem(int arg0) {
		return products.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {

		Store_Base sb = products.get(arg0);
		LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(R.layout.activity_store, null);

		TextView productName = (TextView) v.findViewById(R.id.store_store_text);
		ImageView iv = (ImageView) v.findViewById(R.id.store_store_image);

		productName.setText(sb.getProductName());
		iv.setImageResource(sb.getProductImage());

		return v;
	}
}
